﻿''' <summary>
''' converter that allows binding a window title to a value in the viewmodel
''' the converter parameter is an optional window title prefix that will be prepended before the 
''' bound value when converting the value to the Title
''' </summary>
''' <remarks></remarks>
Public Class WindowNameToTitleConverter
    Implements IValueConverter

    Public Function Convert(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert
        If value Is Nothing Then Return parameter
        Dim prefix As String = Nothing
        If Not parameter Is Nothing Then
            prefix = String.Format("{0} - ", parameter)
        End If
        Return String.Format("{0}{1}", prefix, value)
    End Function

    Public Function ConvertBack(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.ConvertBack
        Throw New NotSupportedException()
    End Function
End Class
